<?php
session_start();
isLogin();

function get_catalog_list_by_id($id,$ji){
	global $prefix;
	
	$result=mysql_query("select * from ".$prefix."column where pid=".$id." order by paixu ");
	$pre='';
	for($i=0;$i<$ji;$i++){$pre .= "--";}
	while($arr=mysql_fetch_array($result)){
		echo "<option value='".$arr['id']."'>".$pre.$arr['name']."</option>";
		$a=mysql_query("select * from ".$prefix."column where pid=".$arr['id']." order by paixu ");	
		if($b=mysql_fetch_array($a)){
			$ji++;
			get_catalog_list_by_id($arr['id'],$ji);
			$ji=0;
		}
	}
}

?>
<script language="javascript" src="<?php echo $website;?>/templates/<?php echo $moban;?>/js/common.js"></script>
<script language="javascript" src="<?php echo $website;?>/templates/<?php echo $moban;?>/js/newDiv.js"></script>
<script language="javascript">
changeWebTitle('生成html管理');
var website="<?php echo $website;?>";
function catClick(id){
	if(id===0){
		makeCatHtml(0);
	}else{
		var id=document.getElementById("cat_catalog").value;
		makeCatHtml(id);
	}
}
function artClick(id){
	if(id===0){
		makeArtHtml(0);
	}else{
		var id=document.getElementById("cat_catalog").value;
		makeArtHtml(id);
	}
}

function makeCatHtml(id){
	checkSelect("<?php echo $website;?>/makehtml.php?type=cat&catalog_id="+id,"生成栏目html",'ajaxcontent',true,false);
}

function makeArtHtml(id){
	checkSelect("<?php echo $website;?>/makehtml.php?type=art&catalog_id="+id,"生成文章html",'ajaxcontent',true,false);
}
</script>
<div class="ContentRight">
    <div class="ContentRightTop">
      <div class="BarLeft"></div>
      <div class="ContentRightTopText">生成html管理</div>
      <div class="BarRight"></div>
      <div class="Cal"></div>
    </div>
    <div class="ContentRightBox">
      <table width="100%" cellpadding="0" class="Table1" bordercolor="#4ab902" border="1" cellspacing="0">
        <tr>
          <td height="25" colspan="2" align="center"><strong>生成栏目html</strong></td>
        </tr>
        <tr>
          <td width="22%" height="25" align="right">按类别生成：</td>
          <td width="78%">
          <select name="cat_catalog" id="cat_catalog">
          <?php
		  get_catalog_list_by_id(0,0);
		  ?>
          </select>
          <input type="button" name="makecat" id="makecat" value="生成" onclick="catClick();"/></td>
        </tr>
        <tr>
          <td height="25" align="right">生成全部：</td>
          <td><input type="button" name="makecatall" id="makecatall" value="生成全部"  onclick="catClick(0);"/></td>
        </tr>
        <tr>
          <td height="25" colspan="2" align="right">&nbsp;</td>
        </tr>
        <tr>
          <td height="25" colspan="2" align="center"><strong>生成文章html</strong></td>
        </tr>
        <tr>
          <td height="25" align="right">按类别生成：</td>
          <td>
          <select name="art_catalog" id="art_catalog">
          <?php
		  get_catalog_list_by_id(0,0);
		  ?>
          </select> <input type="button" name="makeart" id="makeart" value="生成"  onclick="artClick();"/></td>
          </td>
        </tr>
        <tr>
          <td height="25" align="right">生成全部：</td>
          <td><input type="button" name="makeartall" id="makeartall" value="生成全部"  onclick="artClick(0);"/></td>
        </tr>
        <tr>
          <td height="25" align="right">版权所有：</td>
          <td><a href="http://www.fengsh8.com" target="_blank">风尚淘客程序</a></td>
        </tr>
      </table>
    </div>
    <div class="Cal"></div>
</div>